package edu.ubb.scrumster.model.repository;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import edu.ubb.scrumster.model.model.AbstractModel;
import edu.ubb.scrumster.model.model.Organization;

public class OrganizationRepository {

	public OrganizationRepository() {
	}

	public ArrayList<Organization> getAllOrganization() {
		ArrayList<Organization> list = new ArrayList<Organization>();
		for (AbstractModel d : DatabaseAccess.getInstance().getAll(DatabaseAccess.ORGANIZATION)){
			list.add((Organization) d);
		}
		return list;
	}

	public void addOrganization(Organization g) {
		DatabaseAccess.getInstance().addData(g);
	}

	public void updateOrganization(Organization data) {
		DatabaseAccess.getInstance().updateData(data);
	}

	public void deleteOrganization(Organization data) {
		DatabaseAccess.getInstance().deleteData(data);
	}

	public Organization getOrganizationById(int id) {
		return (Organization)DatabaseAccess.getInstance().getDataById(id, DatabaseAccess.ORGANIZATION);
	}
}
